import os
import cv2
import json

from videoscenedetect.process_vsd import process_vsd, screenshotbyscenes
from downloadutils import download_file
video_url = "http://youju-videos.bjcnc.scs-internal.sohucs.com/a03823bf-d6a4-48c3-a4d5-08c49e26ea532_0_0.mp4"
local_url = video_url[video_url.rfind('/')+1:]

print("local_url:",local_url)
if download_file(video_url, local_url):
    ret, scenes = process_vsd(local_url)
    print(scenes)
    if ret > 0:
        screenshotbyscenes(local_url, json.loads(scenes)["scenes"], "./")
